<include file="Public:header" />
<style type="text/css">
    .table_list {
        margin-bottom: 15px;
    }
    .pro_img{
        width: 90%;
        height: 600px;
        margin:auto;
        margin-bottom: 100px;
    }
</style>
<!--楼栋列表-->
<div class="pad_lr_10" >
    <form name="searchform"  method="get" >
    <table width="100%" cellspacing="0" class="search_form">
        <tbody>
        <tr>
            <td>
            <div class="explain_col">
                <input type="hidden" name="m" value="Admin" />
                <input type="hidden" name="c" value="Price" />
                <input type="hidden" name="a" value="index" />
                <input type="hidden" name="menuid" value="{$menuid}" />
                &nbsp;&nbsp;
                <a style="color: #008000" href="{:U('Property/index',array('house_id'=>$house['id'],'menuid'=>150))}">刷新当前页</a>                &nbsp;&nbsp;
                当前编辑是&nbsp;&nbsp;
               <a class="red" title="点击标题可刷新当前页面" href="{:U('Property/index',array('house_id'=>$house['id'],'menuid'=>150))}"><b>{$house.title}</b></a>&nbsp;&nbsp;楼盘沙盘</a>
            </div>
            </td>
        </tr>
        </tbody>
    </table>
    </form>
    <div class="J_tablelist table_list" data-acturi="{:U('Property/ajax_edit')}">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
                <th width=25><input type="checkbox" id="checkall_t" class="J_checkall"></th>
                <th><span data-tdtype="order_by" data-field="id">ID</span></th>
                <th>楼栋</th>
                <th>单元</th>
                <th>层数</th>
                <th>户数</th>
                <th>楼户配比</th>
                <th>开盘时间</th>
                <th>交房时间</th>
                <th>销售状态</th>
                <th>状态</th>
                <th width="100">{:L('operations_manage')}</th>
            </tr>
        </thead>
        <tbody>
            <volist name="list" id="val" >
            <tr>
                <td align="center"><input type="checkbox" class="J_checkitem" value="{$val.id}"></td>
                <td align="center">{$val.id}</td>
                <td align="center">{$val.title}</td>
                <td align="center">{$val.unit}</td>
                <td align="center">{$val.floor}</td>
                <td align="center">{$val.households}</td>
                <td align="center">{$val.stairs}</td>
                <td align="center">{$val.opening_time}</td>
                <td align="center">{$val.check_in_time}</td>
                <td align="center" style="color: {$saleStatus[$val[sale_status]][parameter]}">{$saleStatus[$val['sale_status']]['name']}</td>
                <td align="center"><img data-tdtype="toggle" data-id="{$val.id}" data-field="status" data-value="{$val.status}" src="__IMG__/admin/toggle_<if condition="$val.status eq 0">disabled<else/>enabled</if>.gif" /></td>
                <td align="center">{:Z($options,$val['id'],$val['title'])}</td>
            </tr>
            </volist>
        </tbody>
    </table>
    <div class="btn_wrap_fixed">
        <label class="select_all"><input type="checkbox" name="checkall" class="J_checkall">{:L('select_all')}/{:L('cancel')}</label>
    	<input type="button" class="btn" data-tdtype="batch_action" data-acttype="ajax" data-uri="{:U('Price/delete')}" data-name="id" data-msg="{:L('confirm_delete')}" value="{:L('delete')}" />
        <div id="pages">{$page}</div>
    </div>
    </div>
    <div class="pro_img">
        <link type="text/css" rel="stylesheet" href="__CSS__/admin/shapan.css" />
        <div id="append_parent"></div>
        <div class="mainBox">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class=" tb tb2 bdbot">
                <tbody>
                <tr style="height: 35px;line-height: 35px">
                    <td class="txt txtright fB" style="text-align: center" width="10%"><b>上传沙盘图</b></td>
                    <td class="txt txtleft">
                        <form id="info_form" action="{:U('Property/imgOne')}" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="house_id" value="{$house.id}">
                            <input type="file" style="width:200px;"  id="img" name="img">&nbsp;&nbsp;<input class="btn btn_submit" type="submit" value="上传图片">
                        </form>
                    </td>
                </tr>
                <tr style="height: 35px;line-height: 35px">
                    <td class="txt txtright fB" style="text-align: center" width="10%"><b>楼栋</b></td>
                    <td class="txt txtleft">
                        <input type="checkbox" id="cb_593181" name="cb_593181" value="369,144" data-xszt="2" onclick="sha_add(593181,'16号楼B7',1)" />16号楼B7
                        <input type="checkbox" id="cb_593192" name="cb_593192" value="143,229" data-xszt="1" onclick="sha_add(593192,'15号楼B7',2)" />15号楼B7
                        <input type="checkbox" id="cb_593191" name="cb_593191" value="232,170" data-xszt="1" onclick="sha_add(593191,'17号楼B7',3)" />17号楼B7
                        <input type="checkbox" id="cb_593183" name="cb_593183" value="334,76" data-xszt="3" onclick="sha_add(593183,'16号楼B2',4)" />16号楼B2
                        <input type="checkbox" id="cb_593185" name="cb_593185" value="248,64" data-xszt="3" onclick="sha_add(593185,'15号楼B2',5)" />15号楼B2
                        <input type="checkbox" id="cb_593194" name="cb_593194" value="81,176" data-xszt="2" onclick="sha_add(593194,'17号楼B1',6)" />17号楼B1
                        <input type="hidden" id="fmdata[loudongs]" name="fmdata[loudongs]" value="593181,593192,593191,593183,593185,593194" /></td>
                </tr>
                <tr>
                    <td class="txt txtright fB" style="text-align: center" width="10%">沙盘图</td>
                    <td class="txt txtleft">
                        <div id="shapan" style="overflow:hidden; width:800px; height:480px;position:relative;border:2px solid #CAE4F7">
                            <div id="shapan-i">
                                <img id="MapImages" src="{$info.img}" />
                            </div>
                        </div></td>
                </tr>
                </tbody>
            </table>
        </div>
</div>
<include file="Public:footer" />
<script type='text/javascript' src='__JS__/jquery-1.10.2.min.js'></script>
<script type='text/javascript' src='__JS__/jqmodal.js'></script>
<script type="text/javascript">
    var dots_data = ['593181^16号楼B7:369,144','593192^15号楼B7:143,229','593191^17号楼B7:232,170','593183^16号楼B2:334,76','593185^15号楼B2:248,64','593194^17号楼B1:81,176'];
    var movingNow,dotMoved=0;

    var ld_checked = '593181,593192,593191,593183,593185,593194';
    var ld_checked_aids = ld_checked.split(',');
    for(var i = 0; i < ld_checked_aids.length; i ++){
        var checkbox_id = document.getElementById('cb_'+ ld_checked_aids[i]);
        if(checkbox_id){
            checkbox_id.checked = true;
        }
    }
    sha_init();
    // 初始化-所有点
    function sha_init(id){
        for(var i=0;i<dots_data.length;i++){
            var iarr = dots_data[i].split(':');
            var imsg = iarr[0].split('^');
            var ipos = iarr[1].split(',');
            sha_idot(imsg[0],imsg[1],parseInt(ipos[0]),parseInt(ipos[1]));
        }
        $('#shapan-i').jqDrag({
            attachment:'#shapan'
        })
    }

    // 增加一个点
    function sha_add(id,msg,offset){
        var check_box = document.getElementById('cb_' + id);
        if(check_box.checked == true){
            sha_idot(id,msg,10,10);
        }else{
            sha_del(id);
            return;
        }
    }
    // 删除一个点
    function sha_del(id){
        $('#dot_'+id).remove();
        $('#cb_'+id).prop({checked:false,disabled:false});
        //清理表单项目
    }

    // 显示一个点
    //id:楼栋ID
    //ldmc:楼栋名称
    function sha_idot(id,ldmc,left,top){
        $('<a>',{
            id: 'dot_'+id,
            'class': 'sha-dot sha-dot-'+$('#cb_'+id).attr('data-xszt'),
            html: ldmc+'<i></i><b title="close"></b>'
        })
                .css({
                    left: left,
                    top: top
                })
                .jqDrag({
                    attachment:'#shapan-i'
                })
                .on('dragEnd', function (el, l, t) {
                    $('#' + this.id.replace('dot','cb')).val(l+','+t);
                })
                .appendTo('#shapan-i')
                .find('b').click(function(){ sha_del(id); })
    }
</script>
</body>
</html>
